import { ResponseType } from './type'
import * as msg from './msg'
import { ResponseCode } from './response-code'

function isResSuccess(res: ResponseType): boolean {
  if (!res) {
    msg.info('请求响应了空对象！')
    return false
  }
  if (res.code !== ResponseCode.success) {
    msg.info(res.msg)
    return false
  }

  return true
}

export { isResSuccess }
